package core;

/**
 * Represents an abstract card, which acts as a "base" for concrete cards
 * (instances of the Card class).  For example, in a 52-card deck, there
 * would be an AbstractCard for each card in the deck, which would be the 
 * flyweight (GoF Flyweight pattern) for that type of card. (In a 208-card
 * deck, i.e., four 52-card decks combined, there would still be only 52
 * unique AbstractCards because the types of cards are the same in all decks.)
 * Cards belong to a "set" corresponding to the XML file from which they 
 * were loaded.
 */
public class AbstractCard
{
	/**
	 * Create a new AbstractCard with the given identifier.
	 * @param name a textual name for the card
	 */
	public AbstractCard(String set, String name, String image)
	{
		this.name = name;
		this.set = set;
		this.image = image;
	}

	/**
	 * Returns the XML set from which this card was loaded.
	 */
	public String getSet() {
		return set;
	}

	public String getName() {
		return name;
	}

	public String getImage() {
		return image;
	}

	public void addAttribute(Attribute attribute) {
		attributes.add(attribute);
	}

	public java.util.List<Attribute> getAttributes() {
		return java.util.Collections.unmodifiableList(attributes);
	}

	private final String set, name, image;
	private final java.util.List<Attribute> attributes = new java.util.LinkedList<Attribute>();
}